home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Light ROM 4
/
Light ROM 4 - Disc 1.iso
/
text
/
net_news
/
1994
/
1.doc
/
000048_mohrt@cse.unl.edu_Wed Nov 16 08:07:13 PST 1994.msg
< prev
next >
Wrap
Text File
|
1995-03-23
|
4KB
|
156 lines
Article: 50 of comp.graphics.packages.lightwave
Xref: netcom.com comp.graphics.packages.lightwave:50
Path: netcom.com!ix.netcom.com!howland.reston.ans.net!vixen.cso.uiuc.edu!newsfeed.ksu.ksu.edu!moe.ksu.ksu.edu!crcnis1.unl.edu!cse!mohrt
From: mohrt@cse.unl.edu (Monte Ohrt)
Newsgroups: comp.graphics.packages.lightwave
Subject: Bezier Curve Macro
Date: 16 Nov 1994 01:32:33 GMT
Organization: University of Nebraska--Lincoln
Lines: 141
Distribution: world
Message-ID: <3abnfh$28t@crcnis1.unl.edu>
NNTP-Posting-Host: cse.unl.edu
I uploaded a new Macro for Lightwave Modeler that creates a
Bezier Curve from control points that you create. It is called
"bezier.lwm" and it is on the tomahawk ftp site in /incoming/arexx
For those of you who do not have ftp access, I've included the
script here, since it is quite short anyway.
-snip-
/* Bezier curve creator
* Use selected control points to create a bezier curve.
* By Monte Ohrt�� 1994 The Rendering Plant Inc. */
Version = 1.0
address "LWModelerARexx.port"
libadd = addlib("LWModelerARexx.port",0)
MATHLIB="rexxmathlib.library"
IF POS(MATHLIB , SHOW('L')) = 0 THEN
IF ~ADDLIB(MATHLIB , 0 , -30 , 0) THEN DO
call notify(1,"!Can't find "MATHLIB)
exit
END
sysnam = 'Bezier Curves'
signal on error
signal on syntax
call sel_mode(USER)
call req_begin sysnam
id_txt = req_addcontrol("Create Bezier",'T',"Curves")
id_txt2 = req_addcontrol("By Monte Ohrt",'T',"")
id_seg = req_addcontrol("Number of Points to make",'n')
id_cur = req_addcontrol("Make a Curve?",'B')
id_cntl = req_addcontrol("Keep original control points?",'B')
call req_setval id_seg, 15
call req_setval id_cur, 1
call req_setval id_cntl, 0
if (~req_post()) then do
call req_end
exit
end
curve = ""
segs = req_getval(id_seg)
cur = req_getval(id_cur)
cntl = req_getval(id_cntl)
call req_end()
n = xfrm_begin()
if n=0 then do
call notify(1,"no points selected!")
exit
end
say n
do i = 1 to n
Point.i= xfrm_getpos(i)
say Point.i
end
call xfrm_end()
if (~cntl) then do
call CUT()
end
delta = 1.0/segs
parse value point.1 with x y z
call ADD_BEGIN()
curve = curve add_point(x y z)
call meter_begin (segs-1), "Creating Bezier Curve"
do i = 1 to (segs-1)
t=i*delta
temp2=1
do z=1 to (n-1)
temp2=temp2*(1-t)
end
temp3=1
parse value point.1 with x y z .
sum=temp2*x
sum2=temp2*y
sum3=temp2*z
do k = 1 to (n-1)
temp2=temp2*(n-k)*t
temp3=temp3*k*(1-t)
temp=temp2/temp3
j=k+1
parse value point.j with x y z .
sum=sum+temp*x
sum2=sum2+temp*y
sum3=sum3+temp*z
end
curve = curve add_point(sum sum2 sum3)
call meter_step
end
parse value point.n with x y z
curve = curve add_point(x y z)
call meter_end
if (cur) then do
call ADD_CURVE curve
end
call ADD_END
if (libadd) then call remlib("LWModelerARexx.port")
exit
syntax:
error:
call end_all
t=Notify(1,'!Rexx Script Error','@'ErrorText(rc),'Line 'SIGL)
exit
PointCount: PROCEDURE
n=XFRM_BEGIN()
call END_ALL()
return n
-snip-
enjoy.
Monte
--
------------------- A1200 Seagate 235M 99 bugs in the code, 99
mohrt@cse.unl.edu M1230XA/50/50/16 @60ns bugs, fix one bug, compile
Animator/Modeler PAR equipped Toaster 4000 it again, 101 bugs in the
The Rendering Plant (402) 477-4338 code.....